<?php
include_once "ConnectionManager.php";

function findAllServices($lang){
	$query = "SELECT SEV_ID, SEV_TITLE_$lang, SEV_TITLE_EN FROM GIAAN_SERVICE";
	ConnectionManager::getInstance()->setQuery($query);
    return ConnectionManager::getInstance()->query();
}

function findBy($serviceId, $lang){
	$query = "SELECT SEV_ID, SEV_TITLE_$lang, SEV_CONTENT_$lang FROM GIAAN_SERVICE WHERE SEV_ID = $serviceId";
	ConnectionManager::getInstance()->setQuery($query);
    return ConnectionManager::getInstance()->query();
}

function findById($serviceId){
	$query = "SELECT * FROM GIAAN_SERVICE WHERE SEV_ID = $serviceId";
	ConnectionManager::getInstance()->setQuery($query);
    return ConnectionManager::getInstance()->query();
}

function editService($serviceId, $titleVn, $titleEn, $contentVn, $contentEn){
	$query = "UPDATE GIAAN_SERVICE SET SEV_TITLE_VN = '$titleVn', 
								 SEV_TITLE_EN = '$titleEn', 
								 SEV_CONTENT_VN = '$contentVn', 
								 SEV_CONTENT_EN = '$contentEn' 
								 WHERE SEV_ID = $serviceId";
	ConnectionManager::getInstance()->setQuery($query);
    ConnectionManager::getInstance()->query();
	if(mysql_affected_rows() > 0)
		return true;
	return false;
}

?>